//
// Created by lenovo on 24-12-28.
//
class Solution3 {
public:
    static int removeDuplicates(vector<int>& nums)
    {
        if(nums.empty())
            return 0;

        for(int i=1; i<nums.size(); )
        {
            if(nums[i] == nums[i-1])
            {
                nums.erase(nums.begin()+i);
            }
            else
            {
                i++;
            }
        }
        return nums.size();
    }
};